|
|
|
|
|
|
|
There are five data control properties that deserve special attention: |
|
|
|
|
|
|
|
|
There is a sixth data control property that is used only for data access: the Connect property. The Connect property is used when you are accessing non-Microsoft Access databases. You'll learn more about using the Connect property in the lesson on Day 9. |
|
|
|
|
|
|
|
|
Setting DatabaseName and RecordSource Properties |
|
|
|
|
|
|
|
|
The DatabaseName and RecordSource properties were discussed in Day 3. The DatabaseName property contains the name of the database you want to access. In Microsoft Access databases, this would be the complete drive, path, and filename of the Microsoft Access database file. For example, to connect to the BOOKS5.MDB Microsoft Access database located in the C:\DATA directory, you would set the DatabaseName property to C:\DATA\BOOKS5.MDB. You can do this through the Property box at design time or through Visual Basic code at runtime. |
|
|
|
|
|
|
|
|
Let's start a project to illustrate the data control properties, events, and methods. Load Visual Basic and start a new project. Drop a data control on a blank form. For this project, let's accept the default data control name property of Data1. |
|
|
|
|
|
|
|
|
In Day 3, you set the DatabaseName and RecordSource properties at design time using the Visual Basic properties window. Visual Basic allows you to set most control properties at runtime (that is, while the program is running). The advantage of setting properties at runtime is that you can build programs that allow users to decide what database and data table they want to access. For this project, you'll set these properties at runtime using Visual Basic code. |
|
|
|
|
| |
|
|
|
|
Design time refers to the time when you are designing your Visual Basic application. Runtime refers to the time when your finished application is running. |
|
|
|
|
|
|
|